package net.sf.rose.task;

import java.util.Date;

import net.sf.rose.jdbc.bean.annotation.Column;
import net.sf.rose.jdbc.bean.annotation.Table;
import net.sf.rose.jdbc.bean.annotation.Type;

/**
 * 类说明：开机定时执行任务通用定义类
 * <p>
 * 可以指定任务在启动后立即执行一次
 * <p>
 * 可以指定任务在某个特定的时间执行一次
 * <p>
 * 可以指定任务在个时间后每隔一段时间(秒、分钟、小时、天、周、月)后重复执行
 * 
 * @author fengjian
 * @since 2019/06/20
 */
@Table(name = "SYS_TASK", description = "系统任务")
public class RoseTaskBean {

	@Column(name = "TASK_ID", pk = true, type = Type.定长文本, description = "编号", canNull = false, size = 32, policy = "UUID")
	private String taskID = null;

	/** 1:有效 */
	@Column(name = "NEED_START", type = Type.数字整型, description = "是否需要启动")
	private int needStart = 0;

	@Column(name = "TASK_NAME", type = Type.变长文本, description = "任务名称", size = 100)
	private String taskName = null;

	@Column(name = "DESCRIPTION", type = Type.变长文本, description = "任务说明", size = 250)
	private String description = null;

	@Column(name = "CLASS_NAME", type = Type.变长文本, description = "任务执行类", size = 250)
	private String className = null;

	@Column(name = "EXCUTE_TIME", type = Type.日期时间, description = "定时执行时间")
	private Date excuteDateTime = null;

	/** -1：执行一次；1：重复执行；2：每N秒；3：每N分；4：每N时；5：每N天；6：每周几；7：每N月； */
	@Column(name = "CYCLE_TYPE", type = Type.数字整型, description = "周期执行类型")
	private int cycleType = 1;

	public static int CYCLE_ONCE = -1;
	public static int CYCLE_All = 1;
	public static int CYCLE_SECOND = 2;
	public static int CYCLE_MINITUE = 3;
	public static int CYCLE_HOUR = 4;
	public static int CYCLE_DAY = 5;
	public static int CYCLE_WEEK = 6;
	public static int CYCLE_MONTH = 7;

	@Column(name = "CYCLE_TIME", type = Type.数字整型, description = "周期执行间隔")
	private int cycleTime = 0;

	public String getTaskID() {
		return this.taskID;
	}

	public void setTaskID(String taskID) {
		this.taskID = taskID;
	}

	public String getTaskName() {
		return this.taskName;
	}

	public void setTaskName(String taskName) {
		this.taskName = taskName;
	}

	public int getNeedStart() {
		return this.needStart;
	}

	public void setNeedStart(int needStart) {
		this.needStart = needStart;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getExcuteDateTime() {
		return this.excuteDateTime;
	}

	public void setExcuteDateTime(Date excuteDateTime) {
		this.excuteDateTime = excuteDateTime;
	}

	public int getCycleType() {
		return this.cycleType;
	}

	public void setCycleType(int cycleType) {
		this.cycleType = cycleType;
	}

	public int getCycleTime() {
		return this.cycleTime;
	}

	public void setCycleTime(int cycleTime) {
		this.cycleTime = cycleTime;
	}

	public String getClassName() {
		return this.className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

}
